package game.tileMap
{
	import game.tileMap.model.Actor;
	import game.tileMap.model.Monster;
	import game.tileMap.model.vo.*;
	

	public class DataBase
	{
		public static var skills:XML;
		public static var troops:XML;
		public static var states:XML;
		public static var actors:XML;
		public static var monsters:XML;
		
		private static var _instance:DataBase
		public function DataBase()
		{
		}
		
		public static function getInstance():DataBase{
			if (!_instance) {
				
				_instance=new DataBase();
				
			}
			return _instance;
		}
		
		
		public  function getMonsterVo(id:String):MonsterVo{
			var monster_xml:XML=monsters.monster[int(id)-1] as XML;
			var vo:MonsterVo=new MonsterVo(monster_xml)
			
			return vo;
		}
		/**
		 * 
		 * @param index 在队伍中的位置，从1开始
		 * @param id
		 * @return 
		 * 
		 */		
		public  function getMonster(index:int,id:String):Monster{
			var monster:Monster=new Monster(index,id);
			return monster;
		}
		
		public  function getActorVo(id:String):ActorVo{
			//var xml:XML=actors.monster[int(id)-1] as XML;
			var xml:XML=actors.actor[int(id)-1] as XML;
			var vo:ActorVo=new ActorVo(xml)
			
			return vo;
		}
		
		public  function getActor(id:String):Actor{
			var actor:Actor=new Actor(id);
			
			return actor;
		}
		
//		public  function getState(id:int):RPGState{
//			var state_xml:XML=states.state[id-1] as XML;
//			var vo:RPGState=new RPGState(state_xml)
//			
//			return vo;
//		}
		
		
	}
}